#include "runPython.hpp"
#include "applet.hpp"

#include <boost/python.hpp>
using namespace boost::python;

BOOST_PYTHON_MODULE(robot)
{
    def("wait", wait);
    def("base", baseSpeedModify);
    def("arm1", arm1SpeedModify);
    def("arm2", arm2SpeedModify);
    def("jaws", jawsSpeedModify);
    def("stop", stop);
}

void
Python::start( QString const & _script )
{
	m_script = _script;
	if( isRunning() )
		quit();
	QThread::start();
}

void
Python::run()
{
	Py_Initialize();

	  try {
	    initrobot(); // initialize Pointless
	    PyRun_SimpleString("import robot");
	    PyRun_SimpleString(m_script.toAscii());
	  } catch (error_already_set) {
	    PyErr_Print();
	  }
	  Py_Finalize();

}


